home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / gui / uberwidgets / cleartext.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  4KB  |  106 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. import wx
  5. from wx import RectPS, ClientDC, PaintDC, BoxSizer, HORIZONTAL
  6. from gui.textutil import default_font, Wrap
  7. default_alignment = wx.ALIGN_LEFT | wx.ALIGN_TOP
  8.  
  9. class ClearText(wx.BoxSizer):
  10.     
  11.     def __init__(self, parent, label = '', alignment = default_alignment):
  12.         BoxSizer.__init__(self, HORIZONTAL)
  13.         self.parent = parent
  14.         self.label = self.flabel = label
  15.         self.fontcolor = wx.BLACK
  16.         self.font = default_font()
  17.         self.alignment = alignment
  18.         self.anchor = wx.Window(parent, -1, size = (1, 1), style = wx.BORDER_NONE | wx.TRANSPARENT_WINDOW)
  19.         self.anchor.Bind(wx.EVT_ERASE_BACKGROUND, Null)
  20.         if hasattr(parent, 'ChildPaints'):
  21.             parent.ChildPaints += self.PaintSlave
  22.         else:
  23.             self.anchor.Bind(wx.EVT_PAINT, self.OnPaint)
  24.         self.CalcSize()
  25.  
  26.     
  27.     def Show(self, s = True):
  28.         wx.BoxSizer.Show(self, 0, s)
  29.         wx.BoxSizer.Show(self, 1, s)
  30.         self.Layout()
  31.  
  32.     
  33.     def Hide(self):
  34.         self.Show(False)
  35.  
  36.     
  37.     def UpdateSkin(self):
  38.         self.CalcSize()
  39.  
  40.     
  41.     def CalcSize(self):
  42.         dc = wx.MemoryDC()
  43.         exts = dc.GetMultiLineTextExtent(self.flabel, self.font)[:2]
  44.         self.SetMinSize(exts)
  45.         self.Clear()
  46.         self.Add(self.anchor)
  47.         self.AddSpacer((max(1, exts[0] - 1), exts[1]))
  48.  
  49.     
  50.     def SetFontColor(self, color):
  51.         self.fontcolor = color
  52.  
  53.     
  54.     def GetFontColor(self):
  55.         return self.fontcolor
  56.  
  57.     ForegroundColour = FontColor = property(GetFontColor, SetFontColor)
  58.     
  59.     def SetFont(self, font):
  60.         self.font = font
  61.         self.CalcSize()
  62.  
  63.     
  64.     def GetFont(self):
  65.         return self.font
  66.  
  67.     Font = property(GetFont, SetFont)
  68.     
  69.     def SetLabel(self, label):
  70.         self.label = self.flabel = label
  71.         self.CalcSize()
  72.         self.parent.Refresh(False)
  73.  
  74.     
  75.     def GetLabel(self):
  76.         return self.label
  77.  
  78.     Label = property(GetLabel, SetLabel)
  79.     
  80.     def Position(self):
  81.         return self.anchor.Position
  82.  
  83.     Position = property(Position)
  84.     
  85.     def PaintSlave(self, dc):
  86.         self.OnPaint(None, dc)
  87.  
  88.     
  89.     def OnPaint(self, event, pdc = None):
  90.         if event:
  91.             dc2 = PaintDC(self.anchor)
  92.         
  93.         if not pdc:
  94.             pass
  95.         dc = ClientDC(self.parent)
  96.         dc.Font = self.font
  97.         dc.TextForeground = self.fontcolor
  98.         dc.DrawLabel(self.flabel, RectPS(self.anchor.Position, self.Size), alignment = self.alignment)
  99.  
  100.     
  101.     def Wrap(self, width, maxlines = 0):
  102.         self.flabel = Wrap(self.label, width, self.font, None, maxlines)
  103.         self.CalcSize()
  104.  
  105.  
  106.